# -*- coding: UTF-8 -*-
import os
import netCDF4 as nc
import numpy as np


if __name__ == '__main__':
    data = nc.Dataset(r'D:\数据处理\TMP\tmp_2000.nc', 'r', format = 'NETCDF4')
    print(data.variables.keys())  # 查看变量

    # print(data.variables['pre'].unit) # 查看降水的单位
    # # 输出 0.1 mm
    #
    # print(data.variables['etp'][:].shape) # 查看数据维度
    # # 输出 (12, 5146, 7849)
    #
    # print(data.variables['time'][:].shape) # 查看数据维度
    # # 输出 (12, )
    # print(data.variables['time'][:]) # 查看数据维度
    #
    # # 输出 [ 1.  2.  3.  4.  5.  6.  7.  8.  9. 10. 11. 12.]
    # print(int(data.variables['time'][0])) # 查看数据维度